using OneCaps.Core.Interfaces;

namespace OneCaps.Infrastructure.Hardware
{
    /// <summary>
    /// 道闸控制服务模拟实现
    /// </summary>
    public class MockGateControlService : IGateControlService
    {
        private readonly Dictionary<string, GateStatus> _gateStatus = new();

        public Task<bool> OpenGateAsync(string gateNumber)
        {
            _gateStatus[gateNumber] = GateStatus.Open;
            return Task.FromResult(true);
        }

        public Task<bool> CloseGateAsync(string gateNumber)
        {
            _gateStatus[gateNumber] = GateStatus.Closed;
            return Task.FromResult(true);
        }

        public Task<GateStatus> GetGateStatusAsync(string gateNumber)
        {
            if (_gateStatus.TryGetValue(gateNumber, out var status))
                return Task.FromResult(status);
            return Task.FromResult(GateStatus.Unknown);
        }
    }
} 